<%@ page contentType="text/html;charset=UTF-8" isErrorPage="true"%>
<%@ include file="/comm/include.jsp"%>
<LINK REL=StyleSheet HREF="${ctx }/css/form.css" TYPE="text/css">
<link rel="stylesheet" href="${ctx}/kindeditor/themes/default/default.css" />
<script charset="utf-8" src="${ctx}/kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="${ctx}/kindeditor/zh_CN.js"></script>
<script charset="utf-8" src="${ctx}/dp/WdatePicker.js"></script>

<script>
$(function(){
		$('#rebateForm').form({  
		    url:'${ctx}/rebatedetail/update.htm', 
		    onSubmit: function(){
		    	$("#detail").val(editor.html());
				return $(this).form('validate');
		    },  
		    success:function(data){
		    	if (data == 1) {
			    	window.location.href= "${ctx}/rebatedetail/list.htm?merchantId=${rebateDetail.merchantId}";
				}else {
			    	alert('商户返利详情添加失败');
				}
		    }
		}); 
});
var editor;
KindEditor.ready(function(K) {
	editor = K.create('textarea[name="context"]', {
		resizeType : 1,
		allowPreviewEmoticons : false,
		allowImageUpload : false,
		items : [
			'table','|','paste']
	});
});
</script>

<div>
	<form id="rebateForm" method="post">
		<input type="hidden" name="id" value="${rebateDetail.id}"/>
		<div>
			<div class="form-field" style="padding: 1px;" >
				<p>
					<label class="name" for="startDateStr" >开始时间:</label>
					<input type="text" id="startDateStr" name="startDateStr" value="<fmt:formatDate value="${rebateDetail.startDate}"  pattern="yyyy-MM-dd"/>" class="input" onClick="WdatePicker()" readonly="readonly"/>
				</p>
				<p>
					<label class="name" for="endDateStr" >结束时间:</label>
					<input type="text" id="endDateStr" name="endDateStr" value="<fmt:formatDate value="${rebateDetail.endDate}" pattern="yyyy-MM-dd"/>" class="input" onClick="WdatePicker()" readonly="readonly"/>
				</p>
				<p>
					<label class="name" for="maxRebate" >本期最高返利:</label>
					<input type="text" id="maxRebate" name="maxRebate" value="${rebateDetail.maxRebate}" class="input"/>
				</p>
				<p>
					<label class="name" for="serviceLine" >返利详情:</label>
					<input type="hidden" name="detail" id="detail" value=""/>
					<textarea id="context" name="context" style="width:500px;height:200px;visibility:hidden;">${rebateDetail.detail}</textarea>
				</p>
				<p align="center" class="form-actions">
					<a id="btnSubmit" href="javascript:;" class="easyui-linkbutton" iconCls="icon-save">保存</a>
					<a id="btnReturn" class="easyui-linkbutton" iconCls="icon-undo">返回</a>
				</p>
			</div>
		</div>
	</form>	
</div>
<script src="${ctx}/script/utils.js" type="text/javascript"></script>